UE4 引入插件的头文件,例如ControlRig | 您所在的位置:网站首页 › ue4 插件定义类 › UE4 引入插件的头文件,例如ControlRig |
前言
作为新手C++学习UE4是痛苦的,UE4的蓝图很强大,基本上蓝图可以解决所有问题。但是我们不用蓝图呢?我就要用C++,这就是我痛苦的原因之一。 ControlRig是UE4插件库中的一个插件,有关它的使用都是通过蓝图实现。我查找遍了网上的文章所有ControlRig的使用都是蓝图,没有有关C++实现的文章。 那么开始用C++引用ControlRig插件。我找了一天,终于从零零散散的文章中找到了答案,发现答案的那一刻,我感觉自己像柯南一样。 首先是UE4工程的yourProject.Build.cs PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" ,"ControlRig"}); PublicIncludePaths.AddRange(new string[] { "ControlRig/Public"}); 关闭引擎,在项目的uproject右键,选择Generate Visual Studio Project Files。再重启引擎。 头文件这样引入 #include "ControlRig/Public/ControlRigComponent.h" 在自己的头文件中声明。 UPROPERTY(Category = Mesh, VisibleDefaultsOnly, BlueprintReadWrite) UControlRigComponent* ControlRigComponent; 在自己的CPP构造函数中初始化。 ControlRigComponent = CreateDefaultSubobject(TEXT("ControlRigComponent")); check(ControlRigComponent != nullptr); ControlRigComponent->SetupAttachment(RootComponent);
|
CopyRight 2018-2019 实验室设备网 版权所有 |